import http from './interface'

/**
 * 将业务所有接口统一起来便于维护
 * 如果项目很大可以将 url 独立成文件，接口分成不同的模块
 * 
 */

// 单独导出(测试接口) import {test} from '@/common/vmeitime-http/'
/* export const test = (data) => {
	http.config.baseUrl = "http://39.105.15.97:447/ww.asmx/"
	//设置请求前拦截器
	http.interceptor.request = (config) => {
		config.header = {
			"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
		}
	}
	//设置请求结束后拦截器
	http.interceptor.response = (response) => {
		console.log('个性化response....')
		//判断返回状态 执行相应操作
		return response;
	}
    return http.request({
		baseUrl: 'https://unidemo.dcloud.net.cn/',
        url: 'ajax/echo/text?name=uni-app',
		dataType: 'text',
        data,
    })
} */

//请求通知公告
export const getnotice=()=>{
	return http.request({ 
		/* header:{
			'Access-Control-Allow-Origin':'*',
			'Content-Type': 'application/json'
		}, */
	    url: '/GeNewsList',
		dataType: 'json',
		method:'GET' 
	})
}

//请求通知公告详情
export const getnoticedetail=(data)=>{
	return http.request({
	    url: '/GeNewsListDetails',
		dataType: 'json',
		method:'GET',
		data,
	})
}

// 轮播图
export const banner = (data) => {
    return http.request({
        url: '/banner/36kr',
        method: 'GET', 
        data,
		// handle:true
    })
}
//获取设备列表
export const getdevicelist =()=>{
	return http.request({
	    url: '/GetDeviceList',
		dataType: 'json',
		method:'GET', 
	})
}
//获取设备详情
export const getdevicedetail =(data)=>{
	return http.request({
	    url: '/GetDeviceDetails',
		dataType: 'json',
		method:'GET',
		data,
	})
}

//获取设备知识库
export const getKnowledgeList =(data)=>{
	return http.request({
	    url: '/GeKnowledgeList',
		dataType: 'json',
		method:'GET',
		data,
	})
}
//获取设备知识库详情
export const getKnowledgeDetails =(data)=>{
	return http.request({
	    url: '/GeKnowledgeDetails',
		dataType: 'json',
		method:'GET',
		data,
	})
}

// 默认全部导出  import api from '@/common/vmeitime-http/'
export default { 
	getnotice,
    banner,
	getnoticedetail,
	getdevicelist,
	getdevicedetail,
	getKnowledgeDetails,
	getKnowledgeList,
}